package com.youngjun.user.api.admin;

import com.youngjun.common.mybatis.web.Response;
import com.youngjun.user.pojo.dto.UserDTO;
import com.youngjun.user.pojo.dto.query.UserQueryDTO;
import com.youngjun.user.pojo.vo.UserVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

@Api(tags = "用户管理")
@FeignClient(
        name = "${ums.api.name:ums-service}",
        contextId = "userRestApi",
        url  = "${ums.api.url:http://127.0.0.1:8080}",
        path = "/user"
)
public interface IUserRestApi {

    @ApiOperation(value="查询当前组织部门信息")
    @RequestMapping(method = RequestMethod.POST, path = "/query_list_by_current_organization")
    Response<List<UserVO>> queryListByCurrentOrganization(@RequestBody UserQueryDTO dto);

    @ApiOperation(value="创建当前组织用户信息")
    @RequestMapping(method = RequestMethod.POST, path = "/create_by_current_organization")
    Response<UserVO> createByCurrentOrganization(@RequestBody UserDTO dto);


    @ApiOperation(value="修改当前组织用户信息")
    @RequestMapping(method = RequestMethod.PUT, path = "/modify_by_current_organization")
    Response<UserVO> modifyByCurrentOrganization(@RequestBody UserDTO dto);


    @ApiOperation(value="删除当前组织用户信息")
    @RequestMapping(method = RequestMethod.DELETE, path = "/delete_by_current_organization")
    Response<Void> deleteByCurrentOrganization(@RequestParam Long id);

    @ApiOperation(value="创建用户信息")
    @RequestMapping(value = "/query_list",method = RequestMethod.POST)
    Response<List<UserVO>> queryList(@RequestBody UserQueryDTO dto);

    @ApiOperation(value="创建用户信息")
    @RequestMapping(value = "/create",method = RequestMethod.POST)
    Response<UserVO> create(@RequestBody @Valid UserDTO dto);

    @ApiOperation(value="修改用户信息")
    @RequestMapping(value = "/modify",method = RequestMethod.PUT)
    Response<UserVO>  modify(@RequestBody @Valid UserDTO dto);

    @ApiOperation(value="删除用户信息")
    @RequestMapping(value = "/delete",method = RequestMethod.DELETE)
    Response<Void> delete(@RequestParam Long id);

}